package com.ubxtech.core.context;

/**
 * 跟上下文常量工具类
 * @author Victor.Xiao
 * @since 2022-01-07 19:23
 **/
public final class ContextConstants {
    private ContextConstants() {
    }

    /**
     * 用户id
     */
    public static final String USER_ID = "user_id";
    /**
     * 用户名称
     */
    public static final String USERNAME = "username";
    /**
     * token 类型
     */
    public static final String TOKEN_TYPE = "token_type";
    /**
     * 用户昵称
     */
    public static final String NICKNAME = "nickname";

    /**
     * 客户端id
     */
    public static final String CLIENT_ID = "client_id";

    /**
     * 请求头中的所属区域
     */
    public static final String HEADER_AREA_LIST = "area_list";
    /**
     * 请求头中的是否是管理员,1:是,0:否
     */
    public static final String HEADER_ADMIN_FLAG = "admin_flag";

    /**
     * 刷新 Token
     */
    public static final String REFRESH_TOKEN = "refresh_token";

    /**
     * User信息 认证请求头
     */
    public static final String TOKEN = "token";
    public static final String CONTEXT_TOKEN = "contextToken";
    /**
     * 当前系统追踪id信息头
     */
    public static final String X_TRACE_ID = "x-trace-id";
    /**
     * 上游系统的追踪id信息头
     */
    public static final String P_TRACE_ID = "p-trace-id";

    /**
     * 全局系统的追踪id信息头
     */
    public static final String TRACE_ID = "trace-id";

    /** APP_ID */
    public static final String HEADER_APP_ID = "X-UBT-AppId";
    /** SIGN */
    public static final String HEADER_SIGN = "X-UBT-Sign";
    /**  DEVICE_ID */
    public static final String HEADER_DEVICE_ID = "X-UBT-DeviceId";

    public static final String SIGN_PART_SEPARATOR = " ";

    public static final String SIGN_VERSION_NUM = "v2";

    public static final String PARAM_SN = "sn";

    public static final String PARAM_DOMAIN = "domain";

    public static final String PARAM_PRODUCT_NAME = "productName";

    /** 多租户的值 */
    public static final String KEY_TENANT = "tenant";
    /** 多租户的值,用于租户in模式 */
    public static final String KEY_TENANT_MULTI = "tenant_multi";
    /** 是否忽略多租户 */
    public static final String KEY_IGNORE_TENANT_FLAG = "ignoreTenantFlag";

    public static final String HEADER_REAL_IP = "X-Real-IP";
    public static final String HEADER_FORWARDED_FOR = "x-forwarded-for";

    /** 灰度版本请求头名称
     * 完整示例应该是region-zone-version 如: all-all-version  all-zone1-version
     * region : 地理上的分区，比如北京、上海
     * zone : region内的具体机房,两个机房 zone1、zone2
     * */
    public static final String HEADER_GRAY_VERSION_NAME = "version";
    /**
     * api版本
     */
    public static final String API_VERSION_NAME = "apiVersion";
    /** 时区格式 区域/城市、GMT偏移量、和时区ID +要替换成%2B  */
    public static final String HEADER_TIME_ZONE_ID = "X-UBT-ZoneId";
    /** 来源,服务名称 */
    public static final String HEADER_ORIGIN = "X-UBT-Origin";
    public static final String HEADER_PERMISSION = "X-UBT-Permission";
    public static final String HEADER_IGNORE_TENANT = "X-UBT-IgnoreTenant";
    /** 多语言配置 */
    public static final String HEADER_LANG = "lang";
    public static final String HEADER_LANGUAGE = "Accept-Language";
    public static final String HEADER_CONTENT_LENGTH = "Content-Length";
    public static final String HEADER_CONTENT_TYPE = "Content-Type";


    /** rocket mq 消息环境隔离临时开关key */
    public static final String ROCKET_MQ_ENV_ISOLATION_FLAG = "envIsolationFlag";

    /** 存放在nacos中的元数据,服务id,用于标识哪个服务 ,在启动类前 System.setProperty(ContextConstants.METADATA_SERVICE_ID, "msg-service-" + UuidUtil.get32UUID()); */
    public static final String METADATA_SERVICE_ID = "serviceId";

    /** 消息服务id的开头  */
    public static final String METADATA_WEBSOCKET_SERVICE_NAME_PRE = "msg-service-";

    /** 固定websocket的开头  */
    public static final String METADATA_WEBSOCKET_PATH_PRE = "/ws_connect";

    /** websocket的请求头  */
    public static final String HEADER_UPGRADE = "Upgrade";
    /** websocket的请求头的值  */
    public static final String HEADER_UPGRADE_VALUE = "websocket";

    /** 浏览器信息  */
    public static final String HEADER_USER_AGENT = "user-agent";
}
